#ifndef _CLBRENDERER_H_
#define _CLBRENDERER_H_

#include <buola/widgets/clistbox.h>

namespace buola { namespace gui {

class CLBRenderer : public UUncopiable
{
public:
    CLBRenderer(CListBox*);
    virtual ~CLBRenderer();
    
public:
////////////// Event handling //////////////
    virtual void OnSize(const CGeometryEvent &pE)=0;
    virtual void OnExpose(const CExposeEvent &pE)=0;

    virtual void OnBigChange()=0;
    virtual void OnItemSelected(CListBox::SItem*)=0;
    virtual void OnItemAdded(CListBox::SItem*)=0;
    virtual void OnItemChanged(CListBox::SItem*)=0;
    virtual void OnItemRemoved(CListBox::SItem*)=0;
    virtual void OnFieldsChanged() {}
    virtual void OnXScrollChanged(int) {}
    
///////////////// interface ///////////////////
    virtual CListBox::SItem *GetItemAt(const CPoint_d&,int* =nullptr);
    virtual int GetItemsIn(const CRect_d&,CListBox::SItem*[]);
    
    virtual CSize_d GetIconSize()=0;
    virtual CSize_d GetMaxImageSize()=0;

    virtual PEditBox Edit(CListBox::SItem*)=0;

    virtual CPoint_d GetIconPos(CListBox::SItem*)=0;
    virtual CRect_d GetItemRect(CListBox::SItem*)=0;

    double GetTotalHeight()     {   return mTotalHeight;    }

///////////////// internal /////////////////
    virtual int HitTestItem(CListBox::SItem*,const CPoint_d&)=0;
    virtual int HitTestItem(CListBox::SItem*,const CRect_d&)=0;
    
protected:
    CListBox *mListBox;

    double mTotalHeight;
};

/*namespace gui*/ } /*namespace buola*/ }

#endif
